/*
*** (C) 2008-2009 UCMai.com ***

Subj: 数据字典管理
Auth: yongtaizhou
Date: 2009-02-01
*/

c.pgsubject = '字典类别';
var SysDictCatCore = function(t) {
	//对象类型
	var aCatType = [[1,'单选'],[2,'多选'],[3,'列表']];
	var aCatTypeStore =new Ext.data.SimpleStore({
		fields:[
			{name:'value',type:'int'},
			{name:'text'}
		]
	});
	aCatTypeStore.loadData(aCatType);

	//修改项字段
	this.formReader = [
		{name:'DictCatName'},
		{name:'ObjName'},
		{name:'ObjType'},
		{name:'Remark'}
	];

	//表单项
	this.formItems = [
		{xtype:'hidden',name:'a',id:'se_o_cmdid',value:'0'},
		{xtype:'hidden',name:'li',id:'se_o_li',value:'0'},
		{xtype:'hidden',name:'ln',id:'se_o_ln',value:''},
		{xtype:'hidden',name:'',id:'',value:'0'},
		{xtype:'hidden',name:'DictCatID',id:'DictCatID',value:'0'},
		{xtype:'hidden',name:'t',id:'se_o_t',value:t},
		{
			fieldLabel: '类别名',
			name: 'DictCatName',
			id: 'se_o_dictcatname'+t,
			anchor: '85%',
			maxLength: '60',
			allowBlank: false
		},
		{
			fieldLabel: '对象名',
			name: 'ObjName',
			id: 'se_o_objname'+t,
			anchor: '85%',
			maxLength: '32',
			allowBlank: false
		},
		{
			xtype:'combo',
			store:aCatTypeStore,
			displayField:'text',
			valueField:'value',
			fieldLabel: '对象类型',
			name: 'ObjType',
			hiddenName:'ObjType',
			id: 'se_o_objtype'+t,
			anchor: '85%',
			mode:'local',
			triggerAction: 'all',
			blankText:'请选择对象类型',
			emptyText:'选择对象类型',
			allowBlank:false,
			editable: false
		},
		{
			fieldLabel: '备注',
			name: 'Remark',
			id: 'se_o_remark'+t,
			anchor: '85%',
			maxLength: '60',
			allowBlank: true
		},
		{
			fieldLabel: '属性',
			boxLabel: '缓存该字典数据',
			xtype:'checkbox',
			name: 'IsCache',
			id: 'se_o_IsCache',
			anchor: '85%',
			inputValue:1
		}
	];

	//查看项字段
	this.viewReader = [
		{name:'DictCatID'},
		{name:'DictCatName'},
		{name:'ObjName'},
		{name:'ObjType'},
		{name:'AreaType'},
		{name:'ParentID'},
		{name:'SonNode'},
		{name:'Depth'},
		{name:'OptionSet'},
		{name:'Remark'},
		{name:'Status'}
	];

	//查看项
	this.viewItems = [
		{xtype:'hidden',name:'a',id:'se_o_cmdid',value:'0'},
		{xtype:'hidden',name:'li',id:'se_o_li',value:'0'},
		{xtype:'hidden',name:'ln',id:'se_o_ln',value:''},
		{xtype:'hidden',name:'',id:'',value:'0'},
		{
			fieldLabel: '类别名',
			name: 'DictCatName',
			id: 'se_o_dictcatname'+t,
			anchor: '85%',
			readOnly:true,
			maxLength: '60',
			allowBlank: false
		},
		{
			fieldLabel: '对象名',
			name: 'ObjName',
			id: 'se_o_objname'+t,
			anchor: '85%',
			maxLength: '32',
			readOnly:true,
			allowBlank: false
		},
		{
			fieldLabel: '对象类型',
			name: 'ObjType',
			id: 'se_o_objtype'+t,
			readOnly:true,
			anchor: '85%',
			allowBlank: false
		},
		{
			fieldLabel: '备注',
			name: 'Remark',
			id: 'se_o_remark'+t,
			readOnly:true,
			anchor: '85%',
			maxLength: '60',
			allowBlank: true
		}
	];

	//Grid列头
	//this.sm = new Ext.grid.CheckboxSelectionModel();
	this.gridHeader = [
		//this.sm,
		{header:'类别ID',  dataIndex:'DictCatID',width:30},
		{header:'类别名',  dataIndex:'DictCatNameLink',width:60},
		{header:'对象名',  dataIndex:'ObjName'},
		{header:'对象类型',dataIndex:'ObjType',width:30,renderer:function(value){
			return aCatType[value-1][1];
		}},
		{header:'子节点', dataIndex:'SonNodeLink',width:20},
		{header:'层深',   dataIndex:'Depth',width:20},
		{header:'缓存',   dataIndex:'IsCache',width:15, renderer: function(value){
			return c.YorN[value];
		}},
		{header:'备注',   dataIndex:'Remark'},
		{header:'状态', dataIndex: 'Status', renderer: function(value){
			return '<b><font color="'+ c.aLock[value][1] +'">'+ c.aLock[value][0] +'</font></b>';
		}}
	];

	//Grid绑定的字段
	this.gridStore = [
		{name:'DictCatID'},
		{name:'DictCatName'},
		{name:'DictCatNameLink'},
		{name:'ObjName'},
		{name:'ObjType'},
		{name:'ParentID'},
		{name:'SonNode'},
		{name:'SonNodeLink'},
		{name:'Depth'},
		{name:'IsCache'},
		{name:'OptionSet'},
		{name:'Remark'},
		{name:'CreateOn'},
		{name:'Status'}
	];

	//查看
	this.showView = function(){
		zyt.Permit();
		var selectedId = this.getSelectedIds();
		//selectedId = 2;
		this.form = new Ext.FormPanel({
				labelAlign:'left',
				bodyStyle:'padding:5px',
				frame:true,
				labelWidth:60,
				reader : new Ext.data.JsonReader({
					root : 'record',
					success: '@success'
				},this.formReader),
				items:[
					{
						layout:'form',
						defaultType:'textfield',
						border:false,
						labelSeparator:'：',
						items:this.viewItems
				}]
		});
		this.form.getForm().reset();
		this.window = new Ext.Window({
			xtype:'window',
			title: c.ad(),
			buttonAlign : 'right',
			closable:true,
			resizable: false,
			layout:'fit',
			width:320,
			height:200,
			closeAction:'hide',
			plain: true,
			items:[this.form],
			buttons: [{
				text: c.close,
				handler: function(){
					this.window.hide();
				}.createDelegate(this)
			}]
		});

		this.window.on('hide',function(){
			this.form.destroy();
		}.createDelegate(this));
		this.window.show();

		// local mode 
		this.form.getForm().setValues(this.getSelectionModel().getSelected().data);

		genderTID = this.form.findById('se_o_objtype'+t).getValue();
		for(var i = aCatType.length - 1;i >= 0; i--) {
			if(aCatType[i][0]==genderTID) {
				this.form.findById('se_o_objtype'+t).setValue(aCatType[i][1]);
				break;
			}
		}
	};

	//编辑
	this.showWindow = function(str){
		zyt.Permit();
		var iCurCatID = this.getSelectedIds();
		var sTitle = c.ad();
		if(iCurCatID > 0) sTitle = c.md() + " #" + iCurCatID.toString();
		this.form = new Ext.FormPanel({
				labelAlign:'left',
				bodyStyle:'padding:5px',
				frame:true,
				labelWidth:60,
				reader : new Ext.data.JsonReader({
					root : 'record',
					success: '@success'
				},this.formReader),
				items:[
					{
						layout:'form',
						defaultType:'textfield',
						border:false,
						labelSeparator:'：',
						items:this.formItems
				}]
		});
		this.form.getForm().reset();
		//if (!this.window){
		this.window = new Ext.Window({
			xtype:'window',
			buttonAlign : 'right',
			closable:true,
			resizable: false,
			layout:'fit',
			modal: 'true',
			width:320,
			height:230,
			closeAction:'hide',
			title: sTitle,
			plain: true,
			items:[this.form],
			buttons: [{
				id: 'btnSave',
				text: c.bsave,
				handler: save.createDelegate(this,[str]),
				disabled: false
			},{
				text: c.bcancel,
				handler: function(){
					this.window.hide();
				}.createDelegate(this)
			}]
		});
		this.window.on('hide',function(){
			this.form.destroy();
		}.createDelegate(this));
		//}

		//this.window.show(this.getEl());
		this.window.show();
		this.form.findById('se_o_dictcatname'+t).focus(false,true);
		if(!str){
			// local mode
			this.form.getForm().setValues(this.getSelectionModel().getSelected().data);
		}
	};

	//保存
	var save = function(str){
		if (!this.form.getForm().isValid()){
			return;
		}

		var selectedId = this.getSelectedIds();
		if(str){selectedId = 0;}

		if(selectedId>0){
			this.form.findById('se_o_cmdid').setValue(6);
			this.form.findById('DictCatID').setValue(selectedId);
		}else{
			this.form.findById('se_o_cmdid').setValue(5);
		}

		showLoading(c.g(c.e.save),c.loading);
		zyt.ajax(_C_SysDictCat_S,this.form.getForm().getValues(), function(){
			hideLoading();
			this.window.hide();
			var act = selectedId>0?c.modify:c.add;
			Ext.HandleTip.msg(c.opres,c.item + act + c.ok);
			this.reload();
		}.createDelegate(this));
	};

	//删除
	var remove = function(){
		zyt.Permit();
		confirm(function(){
			var delids = this.getSelectedIds();
			zyt.ajax(_C_SysDictCat_X_Del, {a:4,aid:delids}, function(){
				Ext.HandleTip.msg(c.opres,c.selitem + c.del + c.ok);
				this.reload();
			}.createDelegate(this));
		}.createDelegate(this));
	};

	//锁定
	var lock = function(str){
		zyt.Permit();
		var act = str?c.lock:c.unlock;
		Ext.MessageBox.confirm(c.info,'您确定要将所选' + c.pgsubject + act,function(btn){
			if(btn=='yes'){
				var delids = this.getSelectedIds();
				zyt.ajax(_C_SysDictCat_X_Lock, {a:2,aid:delids}, function(){
					Ext.HandleTip.msg(c.opres,c.selitem + act + c.ok);
					this.reload();
				}.createDelegate(this));
			}
		}.createDelegate(this));
	};

	SysDictCatCore.superclass.constructor.call(this, {
		region: 'center',
		url: _C_SysDictCat_X,
		keyField: 'DictCatID',
		viewConfig: {forceFit:true},
		checkbox: true,
		tbar:[{
				id:'btnAdd'+t,
				text:c.add,
				iconCls:'add',
				handler: this.showWindow.createDelegate(this, [true])
			}, '-',{
				id:'btnModify'+t,
				text:c.modify,
				iconCls:'modify',
				disabled:true,
				handler:this.showWindow.createDelegate(this, [false])
			}, '-',{
				id:'btnLock'+t,
				text:c.lock,
				iconCls:'lock',
				disabled:true,
				handler:lock.createDelegate(this)
			},'-',{
				id:'btnDel'+t,
				text:c.del,
				iconCls:'remove',
				disabled:true,
				handler:remove.createDelegate(this)
		}],
		page: true
	});

	this.getSelectionModel().on('selectionchange', function(){
		var haveselected = this.getSelectedIds();
		if(haveselected!=0){
			if(typeof haveselected==='number'){
				Ext.getCmp('btnModify'+t).setDisabled(false);
				Ext.getCmp('btnDel'+t).setDisabled(false);
				Ext.getCmp('btnLock'+t).setDisabled(false);
			}else{
				Ext.getCmp('btnModify'+t).setDisabled(true);
				Ext.getCmp('btnDel'+t).setDisabled(true);
				Ext.getCmp('btnLock'+t).setDisabled(true);
			}
		}else{
			Ext.getCmp('btnModify'+t).setDisabled(true);
			Ext.getCmp('btnDel'+t).setDisabled(true);
			Ext.getCmp('btnLock'+t).setDisabled(true);
		}
	}.createDelegate(this));

	this.on("rowdblclick", function(grid,rowIndex){
		this.showWindow(false);
	});

	var onContextMenu = function(grid,rowIndex,e){
		e.stopEvent();
		grid.getSelectionModel().selectRow(rowIndex);
		var messageContextMenu = new Ext.menu.Menu({
			id: 'messageContextMenu',
			items : [
			{
				id:'rView',
				text : c.view,
				iconCls:'view',
				handler:this.showView.createDelegate(this)
			},{
				id:'rAdd',
				text : c.add,
				iconCls:'add',
				handler: this.showWindow.createDelegate(this, [true])
			},{
				id:'rModify',
				text : c.modify,
				iconCls:'modify',
				handler:this.showWindow.createDelegate(this, [false])
			},{
				id:'rDel',
				text : c.del,
				iconCls:'remove',
				handler:remove.createDelegate(this)
			}]
		});
		messageContextMenu.showAt(e.getXY());
		e.preventDefault();
	};
	this.on('rowcontextmenu',onContextMenu);


	this.on("activate", function(grid){
		alert('load?');
		this.store.load({params:{start:0, limit:c.page.LargePageSize , t:t}});
	});
};
Ext.extend(SysDictCatCore, Ext.ux.grid.GridPanel);
/*
var SysDictDataCore = function(t){
	//修改项字段
	this.formReader = [
		{name:'DictCatID'},
		{name:'ItemID'},
		{name:'ItemCode'},
		{name:'ItemSubject'},
		{name:'ListIndex'},
		{name:'OptionSet'},
		{name:'Status'}
	];

	//表单项
	this.formItems = [
		{xtype:'hidden',name:'a',id:'se_o_cmdid',value:'0'},
		{xtype:'hidden',name:'li',id:'se_o_li',value:'0'},
		{xtype:'hidden',name:'ln',id:'se_o_ln',value:''},
		{xtype:'hidden',name:'RowID',id:'RowID',value:'0'},
		{xtype:'hidden',name:'t',id:'se_o_t',value:t},
		{
			fieldLabel: '字典ID',
			name: 'ItemID',
			id: 'se_o_itemid'+t,
			anchor: '95%',
			maxLength: '32',
			allowBlank: false
		},
		{
			fieldLabel: '字典代码',
			name: 'ItemCode',
			id: 'se_o_itemcode'+t,
			anchor: '95%',
			maxLength: '32',
			allowBlank: true
		},
		{
			fieldLabel: '显示顺序',
			name: 'ListIndex',
			id: 'se_o_listindex'+t,
			anchor: '95%',
			allowBlank: true
		},
		{
			xtype:'textarea',
			height:200,
			fieldLabel: '字典内容',
			name: 'ItemSubject',
			id: 'se_o_itemsubject'+t,
			anchor: '95%',
			maxLength: '120',
			allowBlank: false
		}
	];

	//查看项字段
	this.viewReader = [
		{name:'DictCatID'},
		{name:'ItemID'},
		{name:'ItemCode'},
		{name:'ItemSubject'},
		{name:'ListIndex'},
		{name:'OptionSet'},
		{name:'Status'}
	];

	//查看项
	this.viewItems = [
		{xtype:'hidden',name:'a',id:'se_o_cmdid',value:'0'},
		{xtype:'hidden',name:'li',id:'se_o_li',value:'0'},
		{xtype:'hidden',name:'ln',id:'se_o_ln',value:''},
		{xtype:'hidden',name:'RowID',id:'RowID',value:'0'},
		{
			fieldLabel: '字典ID',
			name: 'ItemID',
			id: 'se_o_itemid'+t,
			anchor: '95%',
			maxLength: '32',
			allowBlank: false
		},
		{
			fieldLabel: '字典代码',
			name: 'ItemCode',
			id: 'se_o_itemcode'+t,
			anchor: '90%',
			maxLength: '32',
			allowBlank: true
		},
		{
			fieldLabel: '显示顺序',
			name: 'ListIndex',
			id: 'se_o_listindex'+t,
			anchor: '90%',
			allowBlank: true
		},
		{
			xtype:'textarea',
			height:200,
			fieldLabel: '字典内容',
			name: 'ItemSubject',
			id: 'se_o_itemsubject'+t,
			anchor: '90%',
			maxLength: '120',
			allowBlank: false
		}
	];

	//Grid列头
	this.sm = new Ext.grid.CheckboxSelectionModel();
	this.gridHeader = [
		new Ext.grid.RowNumberer(),
		this.sm,
		{header:'字典ID',dataIndex:'ItemID',width:14},
		{header:'字典代码',dataIndex:'ItemCode',width:40},
		{header:'字典内容',dataIndex:'ItemSubject'},
		{header:'显示顺序',dataIndex:'ListIndex',width:14}
	];

	//Grid绑定的字段
	this.gridStore = [
		{name:'RowID'},
		{name:'DictCatID'},
		{name:'ItemID'},
		{name:'ItemCode'},
		{name:'ItemSubject'},
		{name:'ListIndex'}
	];

	//查看
	this.showView = function(){
		permit();
		var selectedId = this.getSelectedId();
		selectedId = 2;
		this.form = new Ext.FormPanel({
				defaults: {width:400},
				labelAlign:'left',
				bodyStyle:'padding:5px',
				frame:true,
				labelWidth:60,
				reader : new Ext.data.JsonReader({
					root : 'record',
					success: '@success'
				},this.viewReader),
				items:[
					{
						layout:'column',
						border:false,
						labelSeparator:'：',
						items:this.viewItems
				}]
		});
		this.window = new Ext.Window({
			xtype:'window',
			title: c.vd(),
			buttonAlign : 'right',
			closable:true,
			resizable: false,
			layout:'fit',
			width:450,
			height:330,
			closeAction:'hide',
			plain: true,
			items:[this.form],
			buttons: [{
				text: c.close,
				handler: function(){
					this.window.hide();
				}.createDelegate(this)
			}]
		});
		this.window.show();

		// local mode 
		this.form.getForm().setValues(this.getSelectionModel().getSelected().data);
	};

	//编辑
	this.showWindow = function(str){
		permit();
		this.form = new Ext.FormPanel({
				labelAlign:'left',
				bodyStyle:'padding:5px',
				frame:true,
				labelWidth:60,
				reader : new Ext.data.JsonReader({
					root : 'record',
					success: '@success'
				},this.formReader),
				items:[
					{
						layout:'form',
						defaultType:'textfield',
						border:false,
						labelSeparator:'：',
						items:this.formItems
				}]
		});
		this.form.getForm().reset();
		//if (!this.window){
		this.window = new Ext.Window({
			xtype:'window',
			buttonAlign : 'right',
			closable:true,
			resizable: false,
			layout:'fit',
			modal: 'true',
			width:500,
			height:350,
			closeAction:'hide',
			plain: true,
			items:[this.form],
			buttons: [{
				id: 'btnSave',
				text: c.bsave,
				handler: save.createDelegate(this,[str]),
				disabled: false
			},{
				text: c.bcancel,
				handler: function(){
					this.window.hide();
				}.createDelegate(this)
			}]
		});
		this.window.on('hide',function(){
			this.form.destroy();
		}.createDelegate(this));
		//}

		//this.window.show(this.getEl());
		this.window.show();
		this.form.findById('se_o_itemid'+t).focus(false,true);
		this.window.setTitle((str)?c.ad():c.md());
		if(!str){
			// local mode 
			this.form.getForm().setValues(this.getSelectionModel().getSelected().data);
		}
	};

	//保存
	var save = function(str){
		if (!this.form.getForm().isValid()){
			return;
		}

		var selectedId = this.getSelectedId();
		if(str){selectedId = 0;}

		if(selectedId>0){
			this.form.findById('se_o_cmdid').setValue(6);
			this.form.findById('RowID').setValue(selectedId);
		}else{
			this.form.findById('se_o_cmdid').setValue(5);
		}

		showLoading(c.g(c.e.save),c.loading);
		ajaxRequest(_C_SysDictData_S,this.form.getForm().getValues(), function(){
			hideLoading();
			this.window.hide();
			var act = selectedId>0?c.modify:c.add;
			Ext.HandleTip.msg(c.opres,c.item + act + c.ok);
			this.reload();
		}.createDelegate(this));
	};

	//删除
	var remove = function(){
		permit();
		confirm(function(){
			var delids = this.getSelectedId();
			ajaxRequest(_C_SysDictData_X, {a:4,aid:delids}, function(){
				Ext.HandleTip.msg(c.opres,c.selitem + c.del + c.ok);
				this.reload();
			}.createDelegate(this));
		}.createDelegate(this));
	};

	//锁定
	var lock = function(str){
		permit();
		var act = str?c.lock:c.unlock;
		Ext.MessageBox.confirm(c.info,'您确定要将所选字典数据' + act,function(btn){
			if(btn=='yes'){
				var delids = this.getSelectedId();
				ajaxRequest(_C_SysDictData_X, {a:2,aid:delids}, function(){
					Ext.HandleTip.msg(c.opres,c.selitem + act + c.ok);
					this.reload();
				}.createDelegate(this));
			}
		}.createDelegate(this));
	};

	var gridReader = new Ext.data.JsonReader({
		totalProperty:'totalProperty',
		root:'records'
		},this.gridStore);

	this.cm = new Ext.grid.ColumnModel(this.gridHeader);
	this.cm.defaultSortable = true;
	this.store = new Ext.data.Store({
		proxy:new Ext.data.HttpProxy({url:_C_SysDictData_X}),
		reader:gridReader,
		baseParams: {limit:c.page.LargePageSize}
	});

	SysDictDataCore.superclass.constructor.call(this, {
		region: 'center',
		store: this.store,
		loadMask: {msg:c.g(c.e.load)},
		cm: this.cm,
		sm: this.sm,
		viewConfig: {forceFit:true},
		tbar:[{
				id:'btnAdd'+t,
				text:c.add,
				iconCls:'add',
				handler: this.showWindow.createDelegate(this, [true])
			}, '-',
			{
				id:'btnModify'+t,
				text:c.modify,
				iconCls:'modify',
				disabled:true,
				handler:this.showWindow.createDelegate(this, [false])
			},'-',{
				id:'btnDel'+t,
				text:c.del,
				iconCls:'remove',
				disabled:true,
				handler:remove.createDelegate(this)
			}],
		bbar: new Ext.PagingToolbar({
			pageSize:c.page.LargePageSize,
			store: this.store,
			displayInfo: true,
			displayMsg: c.pgholder,
			emptyMsg: c.nodata
		})
	});

	this.getSelectionModel().on('selectionchange', function(){
		var haveselected = this.getSelectedId();
		if(haveselected!='0'){
			if(typeof haveselected==='number'){
				Ext.getCmp('btnModify'+t).setDisabled(false);
			}else{
				Ext.getCmp('btnModify'+t).setDisabled(true);
			}
		}else{
			Ext.getCmp('btnModify'+t).setDisabled(true);
			Ext.getCmp('btnDel'+t).setDisabled(true);
		}
	}.createDelegate(this));

	this.on("rowdblclick", function(grid,rowIndex){
		this.showWindow(false);
	});

	var onContextMenu = function(grid,rowIndex,e){
		e.stopEvent();
		grid.getSelectionModel().selectRow(rowIndex);
		var messageContextMenu = new Ext.menu.Menu({
			id: 'messageContextMenu',
			items : [
			{
				id:'rView',
				text : c.view,
				iconCls:'view',
				handler:this.showView.createDelegate(this)
			},{
				id:'rAdd',
				text : c.add,
				iconCls:'add',
				handler: this.showWindow.createDelegate(this, [true])
			},{
				id:'rModify',
				text : c.modify,
				iconCls:'modify',
				handler:this.showWindow.createDelegate(this, [false])
			},{
				id:'rDel',
				text : c.del,
				iconCls:'remove',
				handler:remove.createDelegate(this)
			}]
		});
		messageContextMenu.showAt(e.getXY());
		e.preventDefault();
	};
	this.on('rowcontextmenu',onContextMenu);

	this.getSelectedId = function(){
		var selectedRow = this.getSelections();
		var selectedIds = 0,ss = 0;
		for(var i=0,len=selectedRow.length; i<len; i++){
			ss = parseInt(selectedRow[i].get('RowID'));
			if(i==0)
				selectedIds = ss;
			else
				selectedIds = selectedIds + ',' + ss;
		}
		return selectedIds;
	};

	this.reload = function(){
		this.store.removeAll();
		this.store.reload({params:{start:0, limit:c.page.LargePageSize,t:t}});
	};

	this.on("activate", function(grid){
		this.store.load({params:{start:0, limit:c.page.LargePageSize,t:t}});
	});
};
Ext.extend(SysDictDataCore, Ext.ux.grid.GridPanel);
*/
/*
var loadTabMod = function(config){
	var mainpanel=Ext.getCmp('mainpanel');
	if(mainpanel!=null) {
		for(var minT=config.depth;LABS_NUM>=minT;LABS_NUM--){
			var item=mainpanel.getItem(LABS_NUM);
			if(item){
				mainpanel.remove(item);
				item.setDisabled(true);
			}
		}
	}

	//设置GridPanel附加属性
	config.grid.id = config.depth;
	if(config.depth == 0)
		config.grid.closable = false;
	else
		config.grid.closable = true;

	mainpanel.add(config.grid);

	var item = mainpanel.getItem(config.depth);

	item.setTitle(config.title);
	mainpanel.setActiveTab(config.depth);
	LABS_NUM++;

	if(typeof config.condition==="object"){
		config.grid.reload(config.condition);
	}
};

function loadDictData(dictcatname,dictcatid,depth){
	var title = dictcatname + "『字典数据』";
	loadTabMod({grid:new SysDictDataCore(dictcatid),title:title,depth:depth});
}

function loadDictCat(dictcatname,dictcatid,depth){
	loadTabMod({grid:new SysDictCatCore(dictcatid),title:dictcatname,depth:depth});
}*/

